#pragma once
#include "Asset Library.h"
#include "Indexed Linked List.h"
#include "templatevector.h"
#include "DXEngine.h"
#include "templatevectorlist.h"
//#include "drawlistunit.h"

#define DIRECTX 1
#define OPENGL  2

/**************************************************************************************************/
/* The Graphics class will be able to handle drawing objects derived from BaseObject to the screen
/* Although we do not intend to have OpenGL functionality working for use in this specific project,
/* The Graphics will act as a Platform Independence Layer so that future revisions of this engine
/* will have the option of either using OpenGL or DirectX.
/*
/* -Michael Alstad
/* -Brandon York
/**************************************************************************************************/
class Graphics
{
private:
	/* Declaration of Member variables of Graphics */
	DXEngine				DX;							// an engine that strictly uses DirectX
	HWND					m_hWnd;						// a copy of hWnd from main for initialization
	int						m_iHeight, m_iWidth;		// the screen dimensions
	bool					m_bInitialized;				// indicates whether Init() has been called previously
	bool					m_bInitFailed;				// indicates whether Init() returned false
	bool					m_bWindowed;				// fullscreen = false

	//All things in game drawing at the moment
	IndexedLinkedList*				m_iAllObjects;
	IndexedLinkedList*				m_iMenuObjects;

	/* Prototypes for private functions */
	Graphics();								// private default ctor makes this a singleton
	void Draw(BaseObject* pObj);
	static Graphics * s_g;
public:
	/* Prototypes for public functions */
	static void init(){s_g = new Graphics();}
	static void finalRelease(){delete s_g; s_g = 0;}
	inline static Graphics* Engine()	{ return s_g; }
	bool Init(HWND hWnd, int engineType);

	bool  AddObject(BaseObject* pObj,int AssetIndex, int queueType);
	bool  AddTextToDraw(char* Text,RECT Loc);
	bool  AddIndexLinkedList(ILL* poop, int queueType);
	int   AddAsset(char* textureLoc, color cKey);

	void* RemoveObject(BaseObject* pObj,int queueType);
	bool  RemoveAsset(int index);
	point GetAssetDimensions(int index);

	void Render();
	void Release();
	~Graphics();
};
